(function () {
  // 步骤1：创建echarts实例
  let myChart = echarts.init(document.querySelector(".pc-l3"));

  // 步骤2：定义配置（指定图表的配置项和数据）
  let option = {
    grid: {
      left: 0,
      right: 10,
      top: 20,
      bottom: 10,
      containLabel: true,
    },
    xAxis: {
      type: "category",
      boundaryGap: false, // 坐标轴两边留白
      data: [7, 8, 9, 10, 11, 12],
      // splitLine: {
      //     show: true,
      //     lineStyle: {
      //         color: '#9EA3B4',
      //         type:'dashed',
      //         opacity: 0.2,
      //     },
      // },
    },
    yAxis: {
      type: "value",
      splitLine: {
        show: true,
        lineStyle: {
          color: "#9EA3B4",
          // type:'dashed',
          type: "solid",
          opacity: 0.2,
        },
      },
    },

    series: [
      {
        type: "line",
        smooth: true,
        symbol: "none",
        itemStyle: {
          normal: {
            color: "#4D62FF",
            lineStyle: {
              color: "#4D62FF",
              width: 2,
            },
            areaStyle: {
              //区域填充样式
              color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
                {
                  offset: 0,
                  color: "rgba(77, 98, 255, 0.1)",
                },
                {
                  offset: 1,
                  color: "rgba(77, 98, 255, 0.5)",
                },
              ]),
            },
          },
        },
        toolbox: {
          show: false,
        },
        data: [20, 60, 30, 90, 80, 20],
      },
      {
        type: "line",
        smooth: true,
        symbol: "none",
        itemStyle: {
          normal: {
            color: "#A03CFC",
            lineStyle: {
              color: "#A03CFC",
              width: 2,
            },
            areaStyle: {
              //区域填充样式
              color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
                {
                  offset: 0,
                  color: "rgba(160, 60, 252, 0.1)",
                },
                {
                  offset: 1,
                  color: "rgba(160, 60, 252, 0.5)",
                },
              ]),
            },
          },
        },
        toolbox: {
          show: false,
        },
        data: [60, 20, 50, 40, 70, 100],
      },
    ],
  };

  // 步骤3：使用刚指定的配置项和数据显示图表
  myChart.setOption(option);

  // 步骤4：监控网页视口
  window.addEventListener("resize", () => {
    myChart.resize();
  });
})();
